package com.lcm.weam.service.pro.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.lcm.weam.dao.pro.MemberMapper;
import com.lcm.weam.entity.pro.Member;
import com.lcm.weam.service.pro.MemberService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class MemberServiceImpl implements MemberService {

    @Autowired
    private MemberMapper memberMapper;

    @Override
    public void createMember(Member member) {
        memberMapper.insert(member);
    }

    @Override
    public void editMember(Member member) {
        memberMapper.updateById(member);
    }

    @Override
    public void deleteMember(int mid) {
        memberMapper.deleteById(mid);
    }

    @Override
    public void deleteMembers(String proid) {
        memberMapper.deleteByProid(proid);
    }


    @Override
    public IPage<Member> selectMembers(String proid, int pageIndex, int pageSize) {
        return memberMapper.selectMembers(proid, new Page<Member>(pageIndex, pageSize));
    }
}
